'use strict';

const Controller = require('egg').Controller;

class paymentController extends Controller {
  async paymentOrRejection() {
    const { ctx } = this;
    const sessionInfo = ctx.session.sessionInfo;
    if (!sessionInfo.id) {
      ctx.body = await ctx.service.returnBody.index(null, '请登录！');
    }
    ctx.body = await ctx.service.payment.paymentOrRejection(ctx.request.body);
  }

  async getPaymentList() {
    const { ctx } = this;
    const sessionInfo = ctx.session.sessionInfo;
    if (!sessionInfo.id) {
      ctx.body = await ctx.service.returnBody.index(null, '请登录！');
    }
    ctx.body = await ctx.service.payment.getPaymentList(ctx.request.body);
  }
}

module.exports = paymentController;
